<ui:composition lang="en" xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

	<div class="commentBox">
		<div class="votesAndScore">
			<h:form name="form">
				<h:commandLink styleClass="upVote" update=":form">
					<f:param name="id" value="#{comment.id}" />
					<f:ajax event="click" listener="#{entryBean.voteUp(comment.id)}"
						render="numberOfVotes" />
				</h:commandLink>
				<h:outputText styleClass="score" id="numberOfVotes"
					value="#{comment.score}" />
				<h:commandLink styleClass="downVote">
					<f:param name="id" value="#{comment.id}" />
					<f:ajax event="click" listener="#{entryBean.voteDown(comment.id)}"
						render="numberOfVotes" />
				</h:commandLink>
			</h:form>
		</div>
		<div class="commentDescription">
			<span class="bold greyedOut">#{comment.createdString}</span>
		</div>

		<div class="commentText">
			<p>#{comment.text}</p>
			<c:choose>
				<c:when test="#{userBean.loggedIn}">
					<div class="replyLink greyedOut">
						<a onclick="displayCommentBox(this);">reply</a>
					</div>
					<div class="replyBox" style="display: none">
						<img src="/WhiteIt/img/message.png" alt="message" height="50px"
							style="float: left; margin: 20px;" />
						<h:form class="greyForm">
							<h:inputTextarea value="#{entryBean.commentText}" />

							<h:commandLink value="Comment" action="${entryBean.rateEntry}"
								styleClass="headerlinks">
								<f:param name="ratedEntry" value="#{comment.id}" />
								<f:param name="user" value="#{userBean.username}" />
							</h:commandLink>
						</h:form>
					</div>
				</c:when>
			</c:choose>
		</div>

		<c:if test="#{comment.hasComments}">
			<div class="subcomments" style="clear: left;">
				<c:forEach items="#{comment.ratedByComments}" var="comment">
					<ui:include src="recursiveComments.xhtml" />
				</c:forEach>
			</div>
		</c:if>
	</div>
</ui:composition>